#!/bin/bash
#安装openjdk11
#2022-06-21

#卸载jdk
rpm -qa | grep java
rpm -qa | grep jdk
rpm -qa | grep jdk | xargs rpm -e --nodeps
rpm -qa | grep java | xargs rpm -e --nodeps

#下载安装openjdk11
wget --no-check-certificate https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz
#wget --no-check-certificate https://repo.huaweicloud.com/openjdk/11.0.2/openjdk-11.0.2_linux-x64_bin.tar.gz
tar -zxf openjdk-11_linux-x64_bin.tar.gz -C /opt/

echo '
export JAVA_HOME=/opt/jdk-11
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib
' >> /etc/profile
source /etc/profile
java -version